/**
 * Copyright (c) 2020-2024, huli.com
 * All rights reserved.
 */
package com.xiaohujr.xuexue.leetcode;

import com.alibaba.fastjson.JSON;

import java.util.Arrays;

/**
 * @author Xue Xue (xuexue1@huli.com)
 * @version 1.0
 * @since 2020/8/28
 */
public class LinkListReverse {
    public static class Node {
        public int value;
        public Node next;

        public Node(int data) {
            this.value = data;
        }
    }

    public Node reverse(Node head) {
        if (head == null || head.next == null) {
            return head;
        }
        Node temp = head.next;
        Node newHead = reverse(head.next);
        temp.next = head;
        head.next = null;
        return newHead;
    }

    public static void main(String[] args) {
//        Node a = new Node(1);
//        Node b= new Node(2);
//        Node c= new Node(3);
//        Node d= new Node(4);
//        a.next = b;
//        b.next= c;
//        c.next=d;
//        Node end = new LinkListReverse().reverse(a);

        int[] arrA = new int[]{0,1,2,3};
        int[] arrB = new int[10];
        System.arraycopy(arrA,0,arrB,5,4);
        Arrays.sort(arrB);
        System.out.println(JSON.toJSONString(arrB));
    }


}
